hvmloader: Clarify relationship between xen_domain_handle_t and SMBIOS uuid field.
authorkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Fri, 24 Aug 2007 15:32:56 +0000 (16:32 +0100)
committerkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Fri, 24 Aug 2007 15:32:56 +0000 (16:32 +0100)
Signed-off-by: Keir Fraser <keir@xensource.com>
tools/firmware/hvmloader/smbios.c
tools/firmware/hvmloader/util.h

index fed2df5bfc58a9cb5492236558d7ca5df5afdfa0..07d9e7b848c45e8d6037ca95bedae21b0a63e4ad 100644 (file)
@@ -159,8 +159,7 @@ get_memsize(void)
 int
 hvm_write_smbios_tables(void)
 {
-    uint8_t uuid[16]; /* ** This will break if xen_domain_handle_t is
-                         not uint8_t[16]. ** */
+    xen_domain_handle_t uuid;
     uint16_t xen_major_version, xen_minor_version;
     uint32_t xen_version;
     char xen_extra_version[XEN_EXTRAVERSION_LEN];
@@ -173,6 +172,7 @@ hvm_write_smbios_tables(void)
     unsigned tmp_len; /* length of next string to add */
 
     hypercall_xen_version(XENVER_guest_handle, uuid);
+    BUILD_BUG_ON(sizeof(xen_domain_handle_t) != 16);
 
     /* xen_version major and minor */
     xen_version = hypercall_xen_version(XENVER_version, NULL);
index 42b20bdf0951252c01e502132045f70b513d0731..6ce796b3cc706629db0365da86352a0205c66f22 100644 (file)
@@ -17,6 +17,7 @@ extern void __assert_failed(char *assertion, char *file, int line)
 extern void __bug(char *file, int line) __attribute__((noreturn));
 #define BUG() __bug(__FILE__, __LINE__)
 #define BUG_ON(p) do { if (p) BUG(); } while (0)
+#define BUILD_BUG_ON(p) ((void)sizeof(char[1 - 2 * !!(p)]))
 
 /* I/O output */
 void outb(uint16_t addr, uint8_t  val);